Ext.define('Admin.view.overtime.OvertimeGrid', {
    extend: 'Ext.grid.Panel',
    id:'overtimeGrid',
    xtype:'overtimeGrid',

    requires: [
        'Ext.button.Segmented',
        'Ext.list.Tree'
    ],
    
    title:'我的加班申请记录',

    layout:'fit',
    defaults:{
    	anchor:'80%'
    },

    
    scrollerble:true,
    bind:'{overtimeFormLists}',
    columns:[
    	{text:'申请人',dataIndex:'name',width:60,sortable:true},
    	{text:'创建时间',dataIndex:'createDate',width:150,sortable:true,renderer:Ext.util.Format.dateRenderer('Y/m/d H:i:s')},
    	{text:'开始时间',dataIndex:'beginDate',width:150,sortable:true,renderer:Ext.util.Format.dateRenderer('Y/m/d H:i:s')},
    	{text:'结束时间',dataIndex:'endDate',width:150,sortable:true,renderer:Ext.util.Format.dateRenderer('Y/m/d H:i:s')},
    	{text:'所属部门',dataIndex:'department',width:75,sortable:true},
    	{text:'加班时长',dataIndex:'totalTime',width:75,sortable:true},
    	{text:'加班原因',dataIndex:'reason',sortable:true},
        {text:'状态',dataIndex:'state',width:90,sortable:true},
        {
            text:'操作',
            xtype:'actioncolumn',
            items:[{
                xtype:'button',
                iconCls:'x-fa fa-pencil',
                tooltip:'调整申请',
                getClass:function(v, meta, rec){
                     if (rec.get('taskDefinitionKey')!='reApply') {
                              return 'x-hidden';
                        }
                    return 'x-fa fa-gear';
                },
                handler:'OvertimeOpenReapplyWindow'
            }]
        }
    ],

    dockedItems: {
        xtype: 'toolbar',
        dock: 'top',

        items: [
            {
                xtype: 'datefield',
                fieldLabel: '创建时间',
                name: 'createTime',
                format: 'Y-m-d',
                reference: 'overtimeGridSerchByCreateTime',
                listeners:{
                    change:{
                        fn:'overtimeGridPanelSearch'
                    }
                }
            }, 
            {
                text: '清空',
                listeners: {
                    click: 'overtimeGridPanelclear' //快捷查询按钮
                }
            }
               ]
    },
    
    bbar: Ext.create('Ext.PagingToolbar', {
    	bind:'{overtimeFormLists}',
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "没有任何数据",
        items:['-',{
            iconCls:'x-fa fa-plus',
            tooltip:'添加',
            handler:'OvertimeOpenApplyWindow'
        },'-',{
            iconCls:'x-fa fa-edit',
            tooltip:'修改',
            handler:'OvertimeOpenEditWindow'
        },'-',{
            iconCls:'x-fa fa-trash',
            tooltip:'删除',
            handler:'OvertimeGriddelete'
        },'-',{
            iconCls:'x-fa fa-upload',
            tooltip:'提交申请',
            handler:'OvertimeGridApprove'
        }]
    })
});
